﻿@using Microsoft.AspNet.Identity
@model Blog.Models.PostModel


<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <h2 class="sub-header">Skapa nytt inlägg</h2>

    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()

        <div class="form-horizontal">
            <hr />
            @Html.ValidationSummary(true)

            <div class="form-group">
                @Html.LabelFor(model => model.Title, new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Title, new { @class = "form-control"})
                    @Html.ValidationMessageFor(model => model.Title)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Content, new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.TextAreaFor(model => model.Content, new { @class = "form-control", rows = 8 })
                    @Html.ValidationMessageFor(model => model.Content)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.FeaturedImage, new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.ImageUpload, new {@class = "form-control", type = "file" })
                    @Html.ValidationMessageFor(model => model.ImageUpload)
                </div>
            </div>

            @Html.Hidden("userName", User.Identity.Name)
            <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Spara" class="btn btn-primary btn-lg" />
                </div>
            </div>
        </div>
    }

    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>
</div>

@section scripts
{
    @Scripts.Render("~/bundles/jqueryval")
}
